package com.xunyji.spring_mybatis.controller;

import com.xunyji.spring_mybatis.mapper.CountryMapper;
import com.xunyji.spring_mybatis.model.Country;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 王杨帅
 * @create 2018-09-07 19:07
 * @desc 測試控制層
 **/
@RestController
@RequestMapping(value = "/test")
public class TestController {

    @GetMapping(value = "/test01")
    public String test01() {
        String result = "前後端連接測試";
        return result;
    }

    @Autowired
    private CountryMapper countryMapper;

    @GetMapping(value = "/test02")
    public List<Country> test02() {
        List<Country> countries = countryMapper.selectAll();
        return countries;
    }

}

